<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>悬停展开菜单</title>
    <style>
        #box {
            width: 800px;
            height: 800px;
        }
        span {
            display: block;
            width: 200px;
            height: 50px;
            background-color: orangered;
            cursor: pointer;
            line-height: 50px;
            text-align: center;
            color: white;
            font-weight: bold;
        }
        .childDiv {
            width: 200px;
            max-height: 0;
            overflow: hidden;
            background-color: gainsboro;
            transition: max-height 0.5s ease;
        }
        .box1 {
            margin-left: 10px;
            float: left;
        }
        .childDiv ul {
            list-style: none;
            padding: 0;
            margin: 0;
        }
        .childDiv li {
            padding: 10px;
            border-bottom: 1px solid #ccc;
        }
        .childDiv li:last-child {
            border-bottom: none;
        }
        .active + .childDiv {
            max-height: 200px;
        }
    </style>
</head>
<body>
    <div id="box">
        <div class="box1">
            <span>菜单 1</span>
            <div class="childDiv">
                <ul>
                    <li>菜单项 1</li>
                    <li>菜单项 2</li>
                    <li>菜单项 3</li>
                    <li>菜单项 4</li>
                    <li>菜单项 5</li>
                </ul>
            </div>
        </div>
        <div class="box1">
            <span>菜单 2</span>
            <div class="childDiv">
                <ul>
                    <li>菜单项 1</li>
                    <li>菜单项 2</li>
                    <li>菜单项 3</li>
                    <li>菜单项 4</li>
                    <li>菜单项 5</li>
                </ul>
            </div>
        </div>
        <div class="box1">
            <span>菜单 3</span>
            <div class="childDiv">
                <ul>
                    <li>菜单项 1</li>
                    <li>菜单项 2</li>
                    <li>菜单项 3</li>
                    <li>菜单项 4</li>
                    <li>菜单项 5</li>
                </ul>
            </div>
        </div>
    </div>

    <script>
        var menus = document.querySelectorAll("span");
        
        menus.forEach(function(menu) {
            menu.addEventListener('mouseover', function() {
                // 显示当前菜单
                this.classList.add('active');
                this.style.backgroundColor = "blue";
            });
            
            menu.addEventListener('mouseout', function() {
                // 隐藏当前菜单
                this.classList.remove('active');
                this.style.backgroundColor = "orangered";
            });
        });
    </script>
</body>
</html>